<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;
use module\app\middleware\Auth;

Route::get('help/:type', 'Help/info')->pattern(['type' => '[\w\-]+'])->ext('html'); // 帮助视图

Route::get('info', 'Index/info'); // 系统信息
Route::get('home', 'Index/index')->middleware('format'); // 首页
Route::get('start', 'Index/start')->middleware('format'); // 启动页
Route::post('login', 'Visitor/login')->middleware('throttle', [
    'visit_rate' => '10/m',
])->middleware('format'); // 用户登录限制频率,防止暴力破解
Route::resource('help', 'Help')->only(['read'])->ext('html'); // 帮助视图
Route::resource('teacher', 'Teacher')->only(['index', 'read'])->middleware('format');
Route::resource('activity', 'Activity')->only(['index', 'read'])->middleware('format');
Route::resource('album', 'Album')->only(['index', 'read'])->middleware('format');

Route::group(function () {
    Route::put('notice/status', 'Notice/status'); // 设置消息状态
    Route::resource('notice', 'Notice')->only(['index']); // 消息通知
    Route::resource('pay', 'Pay')->only(['index', 'read', 'save', 'update', 'delete']); // 支付
    Route::resource('activity', 'Activity')->except(['create', 'edit']); // 活动
    Route::resource('activity-detail', 'ActivityDetail')->only(['save', 'update']); // 活动详情
    Route::resource('activity-album', 'ActivityAlbum')->only(['save', 'del']); // 活动相册
    Route::resource('activity-worker', 'ActivityWorker')->only(['save', 'del']); // 活动工作人员
    Route::resource('activity-enroll', 'ActivityEnroll')->except(['create', 'edit']); // 活动报名
    Route::resource('dynamic', 'Dynamic')->except(['create', 'edit']); // 动态
    Route::resource('dynamic-comment', 'DynamicComment')->except(['create', 'edit']); // 动态评论
    Route::resource('feedback', 'Feedback')->only(['index', 'save', 'delete']);  // 实名认证
    Route::resource('user-voucher', 'UserVoucher')->only(['index', 'save']); // 代金券
    Route::resource('user-point', 'UserPoint')->only(['index', 'save']); // 金粉
    Route::resource('user-deposit', 'UserDeposit')->only(['index', 'save']); // 提现
    Route::get('order/checkout', 'Order/checkout'); // 订单
    Route::resource('user-signin', 'UserSignin')->only(['index', 'save']); // 签到
    Route::resource('user-focus', 'UserFocus')->only(['index', 'save', 'delete']); // 关注
    Route::resource('user-fans', 'UserFans')->only(['index', 'save', 'delete']); // 粉丝
    Route::resource('user-invite', 'UserInvite')->only(['index', 'save', 'delete']); // 邀请
    Route::resource('user-upvote', 'UserUpvote')->only(['index', 'save', 'delete']); // 点赞
    Route::resource('user-worker', 'UserWorker')->only(['index', 'save', 'delete']); // 职位
    Route::resource('order', 'Order')->except(['create', 'edit']); // 订单
    Route::post('me/reset', 'Me/reset'); // 重置密码
    Route::resource('me', 'Me')->only(['index', 'update', 'delete']);
    Route::resource('user', 'User')->only(['index', 'read']);
})->middleware([Auth::class, 'format']);

